import 'package:flutter/material.dart';
import 'package:flutter_app/wx/views/message_page.dart';

class HomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: renderAppBar(),
      body: MessagePage(),
      bottomNavigationBar: renderBottomNavigationBar(),
    );
  }

  Widget renderAppBar() {
    return AppBar(
      title: Text('微信(16)'),
      centerTitle: true,
      actions: <Widget>[
        IconButton(
          icon: Icon(Icons.add),
          onPressed: () {
            print('#appBar.add btn clicked');
          },
        ),
      ],
    );
  }

  Widget renderBottomNavigationBar() {
    return BottomNavigationBar(
      fixedColor: Theme.of(context).primaryColor,
      type: BottomNavigationBarType.fixed,
      items: <BottomNavigationBarItem>[
        BottomNavigationBarItem(
          icon: Icon(Icons.add_chart),
          label: '微信',
        ),
        BottomNavigationBarItem(
          icon: Icon(
            Icons.contacts,
          ),
          label: '通讯录',
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.add),
          label: '发现',
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.add),
          label: '我',
        )
      ],
    );
  }
}
